// VirtualOps.Vix.h
#include "vix.h"
#pragma once

using namespace System;

namespace VirtualOps { namespace Vix { 

    public ref class VirtualMachine : public VirtualOps::Base::IVirtualMachine
	{
    public: 
        VirtualMachine(VixHandle vmHandle) : _vmHandle(vmHandle) {}
        
        ~VirtualMachine() 
        {         
            VixHost_Disconnect(_vmHandle);
            _vmHandle = VIX_INVALID_HANDLE;
        }

        virtual property String^ Name { String^ get() { return _name; } }
        
        property String ^ Path { String^ get() { return _path; } }

	    property bool Valid { 
            bool get() { return _vmHandle != VIX_INVALID_HANDLE; }
        }

        virtual void SetProperties();
		virtual void Start();
		virtual void Stop();
		virtual void Suspend();
		virtual void Remove();
		virtual void Resume();
        
    private: 
        String^ _name;
        String^ _path;
		String^ _teamPath;
		int     _memorySize;
		int     _inVMTeam;
		VixPowerState	_powerState;
		VixToolsState	_toolsState;
		int	    _isRunning;
		int     _numVCPUS;

        VixHandle _vmHandle;

        void ParseVmx();

	};
} } // namespace VirtualOps::Vix

